package com.example.photography.adapter.focus;

import android.content.Context;
import android.net.Uri;
import android.view.View;

import com.example.photography.R;
import com.example.photography.adapter.MyBaseAdapter;
import com.example.photography.bean.FocusBean;

import java.util.List;

public abstract class UserAdapter extends MyBaseAdapter {
    public UserAdapter(List list, Context context) {
        super(list, context);
    }

    @Override
    public View myGetView(int position, View convertView) {
        FansAdapter.ViewHolder holder = null;
        if (convertView == null) {
            convertView = View.inflate(mContext, R.layout.item_user, null);
            holder = new FansAdapter.ViewHolder(convertView);
            convertView.setTag(holder);
        } else {
            holder = (FansAdapter.ViewHolder) convertView.getTag();
        }
        //装载数据
        FocusBean.DataBean.FocussBean focussBean = (FocusBean.DataBean.FocussBean) list.get(position);
        holder.svImage.setImageURI(Uri.parse(focussBean.getImage()));
        holder.tvName.setText(focussBean.getName());
        holder.tvIdentify.setText(focussBean.getIdentity());
        if (!focussBean.isIsfocus()){
            holder.tvFocus.setVisibility(View.VISIBLE);
        }else {

        }

        holder.tvFocus.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                focus();
            }
        });
        return convertView;
    }
    public abstract void focus();

}
